package com.mate.cloud;

import com.mate.cloud.user.domain.User;
import com.mate.cloud.user.service.UserService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
class MateDemoApplicationTests {

    private List<User> users;

    @Test
    void contextLoads() {
    }


    @Autowired
    private UserService userService;

    @Test
    void findById() {
        this.users.forEach(User -> {
            Assertions.assertNotNull(User.getId());
            List<User> byId = this.userService.list();
            Assertions.assertFalse(byId.isEmpty());
            byId.forEach(user -> {
                Assertions.assertNotNull(user.getId());
                Assertions.assertNotNull(user.getGender());
            });
        });
    }

    @Test
    void queryByUsers() {


        List<User> byId = this.userService.list();
        Assertions.assertFalse(byId.isEmpty());
        byId.forEach(user -> {
            Assertions.assertNotNull(user.getId());
            Assertions.assertNotNull(user.getGender());
        });

    }
}
